{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.6 特殊矩阵和向量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 对角矩阵"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对角阵（`diagonal matrix`）是一个主对角线之外的元素皆为 0 的矩阵。对角线上的元素可以为 0 或其他值。\n",
    "\n",
    "如果矩阵 $\\bf D$ 是对角阵，则 $D_{i,j} = 0 \\forall i\\neq j$。\n",
    "\n",
    "单位矩阵是对角阵。\n",
    "\n",
    "对于 $n\\times n$ 对角方阵，我们可以用主对角线上的元素将其表示为：$\\mathbf D = \\text{diag}(\\bf v)$，表示 $D_{i,i} = v_i$。\n",
    "\n",
    "对角方阵有很多好的性质：\n",
    "\n",
    "- 与向量的乘法：$\\text{diag}\\bf(v) x = v \\odot x$\n",
    "- 逆：$\\text{diag}(\\mathbf v)^{-1} = \\text{diag}([1/v_1,\\dots,1/v_n]^\\top)$\n",
    "\n",
    "注意对角矩阵不一定是对角方阵。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 对称矩阵"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对称矩阵（`symmetric matrix`）满足转置操作下的不变性：\n",
    "\n",
    "$$\n",
    "\\bf A^\\top=A\n",
    "$$\n",
    "\n",
    "即 $\\forall i, j, A_{i,j} = A_{j, i}$。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 单位向量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "模（$L^2$ 范数）为 1 的向量叫做单位向量（`unit vector`）：\n",
    "\n",
    "$$\n",
    "\\|\\mathbf x\\|_2 = 1\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 向量正交"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "两个向量的内积为 0 时，我们称这两个向量正交（`orthogonal`）：\n",
    "\n",
    "$$\n",
    "\\mathbf{x^\\top y} = 0\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 单位正交"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果一组单位向量两两正交，称这组向量是单位正交的（`orthonormal`）。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 正交矩阵"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果一个方阵的逆矩阵就是它的转置，那么我们称这个矩阵是正交矩阵（`orthogonal matrix`）：\n",
    "\n",
    "$$\n",
    "\\bf A^\\top A=AA^\\top = I\n",
    "$$"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
